<template>
  <div id="app">
	  
	  
     <router-view /> 
  </div>
</template>

<script>
"use strict";
export default {
  name: 'App',
  mounted() {
  
  	let wsuri = "./websocket/index"; //ws地址
  	this.websock = new WebSocket(wsuri);
  	if (this.websock) {
  
  		this.initWebSocket();
  	}
  
  	/* this.getSystemInfoNum();
  	this.getSystemNormalNum(); */
  },
  methods:{
	  initWebSocket() { //初始化weosocket
	  
	  	let _this = this;
	  	this.websock.onopen = _this.websocketonopen;
	  
	  	// this.websocket.onerror = _this.websocketonerror;
	  	this.websock.onmessage = _this.websocketonmessage;
	  	this.websock.onclose = _this.websocketclose;
	  
	  },
	  websocketonopen() {
	  	this.websocketsend("ok");
	  	console.log("WebSocket连接成功");
	  },
	  websocketonerror(e) { //错误
	  	console.log("WebSocket连接发生错误");
	  },
	  websocketonmessage(e) {
	  	
	  this.$store.dispatch('initSystemList').then(() => {
		  console.log("刷新系统信息");
	  })
	  },
	  websocketsend(agentData) { //数据发送
	  	// this.websock.send(agentData); 
	  },
	  websocketclose(e) { //关闭 
	  	console.info("close connection");
	  }
  }
}
</script>

<style>
#app {
  font-family: 微软雅黑;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --text-align: center;
  color: #2c3e50;
  overflow: hidden;
  margin: 0;
  padding: 0;

}
body{
	margin: 0;
	padding: 0px;
	--text-align: center;
	background-color: #F5F7F9;
	--padding-bottom: 20px;
	  
}

	
	.article {
	  
	  --margin: 30px auto;
	   overflow: hidden;
	   text-align: left;
	  --padding-left: 30px;
	 }
	
	 /* markdown 行号的样式 */
	 /* #content li {
	 	list-style: decimal;
	 } */
	
	 .article div pre {
	 	position: relative;
	 	padding: 0 29px;
	 	overflow: hidden;
	 	font-size: 90%;
	 	line-height: 20px;
	 	background: #282c34;
	 }
	
	 .article div pre code {
		padding-left: 40px;
	 }
	
	 .article div .pre-numbering {
	 	position: absolute;
	 	top: 0;
	 	left: 0;
	 	width: 29px;
	 	padding: 0.3em 7px 12px 0;
	 	border-right: 1px solid #C3CCD0;
	 	background: #282c34;
	 	text-align: right;
	 	font-size: 16px;
	 	line-height: 20px;
		margin-top: 0px;
	 }
	
	 .pre-numbering li{
	 	list-style:none;
	 	font-family: Menlo, monospace;
	 	color: #abb2bf;
	 }
	
	
	.el-pagination{
		text-align: right;
	}

</style>
